﻿namespace LambdaCalc.Parser.Tests

open System
open NUnit.Framework

open LambdaCalc

[<TestFixture>]
type ``test command-input``() = 

    let parse = Parser.LambdaParser.parse

    [<Test>]
    member test.``'?quit' is parsed into Command Quit``() =
        let input = "?quit"
        let expectedOutput = Parser.Quit |> Parser.Command
        let parserResult = parse input
        Assert.AreEqual(expectedOutput, parserResult)

    [<Test>]
    member test.``'?Quit' is parsed into Command Quit``() =
        let input = "?Quit"
        let expectedOutput = Parser.Quit |> Parser.Command
        let parserResult = parse input
        Assert.AreEqual(expectedOutput, parserResult)

    [<Test>]
    member test.``'?QUIT' is parsed into Command Quit``() =
        let input = "?QUIT"
        let expectedOutput = Parser.Quit |> Parser.Command
        let parserResult = parse input
        Assert.AreEqual(expectedOutput, parserResult)

    [<Test>]
    member test.``'?load "numb.lcs"' is parsed into Command Load(numb)``() =
        let input = @"?load ""numb.lcs"""
        let expectedOutput = Parser.Load "numb.lcs" |> Parser.Command
        let parserResult = parse input
        Assert.AreEqual(expectedOutput, parserResult)

    [<Test>]
    member test.``'?load "numbers"' is parsed into Command Load(numbers)``() =
        let input = @"?load ""numbers"""
        let expectedOutput = Parser.Load "numbers" |> Parser.Command
        let parserResult = parse input
        Assert.AreEqual(expectedOutput, parserResult)

    [<Test>]
    member test.``'?load numbers' is parsed into Command Load(numbers)``() =
        let input = @"?load numbers"
        let expectedOutput = Parser.Load "numbers" |> Parser.Command
        let parserResult = parse input
        Assert.AreEqual(expectedOutput, parserResult)

    [<Test>]
    member test.``'?enableBodyReductionDelay' is parsed into Command EnableBodyReductionDelay``() =
        let input = @"?enableBodyReductionDelay"
        let expectedOutput = Parser.EnableBodyReductionDelay |> Parser.Command
        let parserResult = parse input
        Assert.AreEqual(expectedOutput, parserResult)

